package mess;

public class LeeCode_69 {
    public static void main(String[] args) {
        System.out.println(mySqrt(6));
    }
    private static int mySqrt(int x) {
        if (x == 1)
            return 1;
        int min = 0;
        int max = x;
        while (max > min + 1){
            int m = (min + max) / 2;
            if (x / m < m)
                max = m;
            else
                min = m;
        }
        return min;
    }
}
